FROM openanolis/anolisos:23

LABEL \
    maintainer="OpenAnolis AI SIG" \
    org.opencontainers.image.title="pytorch-amd" \
    org.opencontainers.image.version="1.12-23-zendnn4.0"

ARG TARGETARCH
RUN if [ "${TARGETARCH}" = "amd64" ]; \
then dnf install unzip python3-pip python3-typing-extensions python3-numpy gperftools-libs -y && \
     curl -O http://mirrors.openanolis.cn/anolis-wheels/pytorch/PT_v1.12_ZenDNN_v4.0_Python_v3.10.zip && \
     unzip PT_v1.12_ZenDNN_v4.0_Python_v3.10.zip && \
     pip3 install PT_v1.12_ZenDNN_v4.0_Python_v3.10/torch-1.12-cp310-cp310-manylinux2014_x86_64.whl && \
     cp PT_v1.12_ZenDNN_v4.0_Python_v3.10/Notices_Licenses_PT_v1.12_ZenDNN_v4.0.txt / && \
     rm -rf PT_v1.12_ZenDNN_v4.0_Python_v3.10* && \
     echo "/usr/lib64/libtcmalloc.so.4" >> /etc/ld.so.preload ;\
fi

CMD ["/bin/bash"]
